<template>
  <div class="">
    <div>
      <van-search
        v-model="querydata.name"
        show-action
        placeholder="请输入搜索关键词"
        @search="onSearch"
        @cancel="onCancel"
        input-align="center"
      />
    </div>
    <div class="infoview">
      <p @click="clickcpmpany(item.protocolId)" v-for="(item,index) in datalist" :key="index">{{item.info}}</p>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return{
      querydata:{
        corpId:null,
        name:null
      },
      datalist:[]
    }
  },
  created(){
    this.querydata.corpId = this.$route.query.corpId
    this.getdata()
  },
  methods:{
    getdata(){
      this.$Api
        .get("/api/cqhProtocol/getProtocolInfos",this.querydata)
        .then(res=>{
          if (res.data.code == 200) {
            this.datalist = res.data.data.data
          }
        })
    },
    clickcpmpany(e){
      this.$router.push({path:'/PersonalCar/Leaseagreement', query:{protocolId: e}})
    },
    onSearch() {
      this.getdata();
    },
    onCancel() {
      this.querydata.name = null;
      this.getdata();
    }
  }
}
</script>

<style scoped>
.infoview p{
  padding: 1rem;
  border-bottom: 0.1rem solid rgba(0, 0, 0, 0.1);
}
</style>
